function ccR_Warlock_3()
	if ccrPlayerLevel() >= 10 and ccrPlayerLevel() <= 90 then ccR_Warlock_Destruction_10_89() end
end

function ccR_Warlock_Destruction_10_89()

--	if SpellIsReady("Demonic Siphon") then ccrCast("Demonic Siphon") end
--	if SpellIsReady("Fel Flame Breath") then ccrCast("Fel Flame Breath") end
--	if SpellIsReady(132411) then ccrCast(132411) end

	-- Before Aftermath, Ensure we dont keep cutting off Rain of Fire
	if ccrPlayerIsChannelingSpell(RAIN_OF_FIRE) then return end

	if ccrPlayerHasSpell(RAIN_OF_FIRE)
	and ccrPlayerHasSpell(AFTERMATH)
	then
		-- Fire and Brimstone on 2+ Targets
		-- Remove buff if we dont have any embers to use it
		if ccrPlayerHasBuff("Fire and Brimstone")
		and ccrEmbers() == 0
		then
			CancelUnitBuff("Player","Fire and Brimstone")
			return
		end
		-- Single Target Rotation
		local vCount = ccrTargetCount(12)
		if (ccRS.Auto_AoE and (vCount >= 1 and vCount <= ccRS.Warlock_3_SingleTargetCount))
		or (ccrTargetIsBoss() and ccRS.Auto_AoE_Ignore_On_Boss)
		or (not ccRS.Auto_AoE and not ccRS.Manual_AoE)
		then
			if ccrPlayerIsInCombat() then
				-- Talents
					-- 15
					ccR_Warlock_Dark_Regeneration()
					-- 30
					ccR_Warlock_Demonic_Breath()
					ccR_Warlock_Mortal_Coil()
					ccR_Warlock_Shadowfury()
				-- Abilities
				ccR_Warlock_Curse_of_Enfeeblement()
				ccR_Warlock_Curse_of_the_Elements()
				ccR_Warlock_Ember_Tap()
				ccR_Warlock_Unending_Resolve()
				ccR_Warlock_Twilight_Ward()
			end

			ccR_Warlock_Rain_of_Fire()
			ccR_Warlock_Havoc()
			ccR_Warlock_Switch_Away_From_Havoc()
			ccR_Warlock_Shadowburn()

			-- Immolate all
			if ccrPlayerHasSpell(IMMOLATE)
			and ccRS.Warlock_3_ImmolateAll
			and not ccrPlayerIsMoving()
			and	ccR_Warlock_CheckForMissingImmolate()
			and not ccrTargetIsBoss()
			then
				ccR_Warlock_ApplyMissingImmolate()
			else
				ccR_Warlock_Backlash()
				-- lvl10-11 Corruption
				ccR_Warlock_Corruption()		
				-- lvl12+ Immolate
				ccR_Warlock_Immolate()
				-- Chaos Bolt
				if SpellCanAttack(CHAOS_BOLT) 
				--and (ccrTargetIsBoss() or ccrTargetIsRare())
				then
					ccrCastAttack(CHAOS_BOLT)
					return
				else
					-- Conflagrate
					if SpellCanAttack(CONFLAGRATE) then
						ccrCastAttack(CONFLAGRATE)
						return
					else
						-- Incinerate
						if SpellCanAttack(INCINERATE)
						and not ccrPlayerIsMoving()
						then
							ccrCastAttack(INCINERATE)
							return
						end
					end
				end
			end
		return
		end
		-- AoE Rotation
		if (ccRS.Auto_AoE and vCount >= ccRS.Warlock_3_AoECount)
		or (not ccRS.Auto_AoE and ccRS.Manual_AoE)
		then
			ccR_Warlock_Rain_of_Fire()
			ccR_Warlock_Shadowburn()
			ccR_Warlock_Fire_And_Brimstone()
			if ccrPlayerHasBuff(FIRE_AND_BRIMSTONE) then
				if not ccrTargetHasDebuff(IMMOLATE) then
					ccR_Warlock_Immolate()
				else
					-- Conflagrate
					if SpellCanAttack(CONFLAGRATE) then
						ccrCastAttack(CONFLAGRATE)
						return
					else
						-- Incinerate
						if SpellCanAttack(INCINERATE)
						and not ccrPlayerIsMoving()
						then
							ccrCastAttack(INCINERATE)
							return
						end
					end
				end
			else
				-- Immolate all
				if ccrPlayerHasSpell(IMMOLATE)
				and ccRS.Warlock_3_ImmolateAll
				and not ccrPlayerIsMoving()
				and	ccR_Warlock_CheckForMissingImmolate()
				then
					ccR_Warlock_ApplyMissingImmolate()
				else
					-- Conflagrate
					if SpellCanAttack(CONFLAGRATE) then
						ccrCastAttack(CONFLAGRATE)
						return
					else
						-- Incinerate
						if SpellCanAttack(INCINERATE)
						and not ccrPlayerIsMoving()
						then
							ccrCastAttack(INCINERATE)
							return
						end
					end					
				end
			end
		end
	else
		if ccrPlayerIsInCombat() then
			-- Talents
				-- 15
				ccR_Warlock_Dark_Regeneration()
				-- 30
				ccR_Warlock_Demonic_Breath()
				ccR_Warlock_Mortal_Coil()
				ccR_Warlock_Shadowfury()
			-- Abilities
			ccR_Warlock_Curse_of_Enfeeblement()
			ccR_Warlock_Ember_Tap()
		end

		ccR_Warlock_Rain_of_Fire()
		ccR_Warlock_Havoc()
		ccR_Warlock_Switch_Away_From_Havoc()
		ccR_Warlock_Shadowburn()

		-- Immolate all
		if ccrPlayerHasSpell(IMMOLATE)
		and ccRS.Warlock_3_ImmolateAll
		and not ccrPlayerIsMoving()
		and	ccR_Warlock_CheckForMissingImmolate()
		then
			ccR_Warlock_ApplyMissingImmolate()
		else
			ccR_Warlock_Backlash()
			-- lvl10-11 Corruption
			ccR_Warlock_Corruption()		
			-- lvl12+ Immolate
			ccR_Warlock_Immolate()
			-- Chaos Bolt
			if SpellCanAttack(CHAOS_BOLT) then
				ccrCastAttack(CHAOS_BOLT)
				return
			else
				-- Conflagrate
				if SpellCanAttack(CONFLAGRATE) then
					ccrCastAttack(CONFLAGRATE)
					return
				else
					-- Incinerate
					if SpellCanAttack(INCINERATE)
					and not ccrPlayerIsMoving()
					then
						ccrCastAttack(INCINERATE)
						return
					end
				end
			end
		end
	end
end